package com.mhy.controller;

import com.baomidou.lock.annotation.Lock4j;
import com.mhy.entity.User;
import com.mhy.service.UserService;
import io.swagger.annotations.Api;
import lombok.SneakyThrows;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "lock4j分布式锁")
@RestController
@RequestMapping("lock")
public class LockController {
@Resource
    private UserService userService;
    @GetMapping("hello")
    @SneakyThrows
    public Object testLock(@RequestParam String key) {
        System.out.println("key----"+key);
        userService.testLock(key);
        return ResponseEntity.ok("success");
    }
}

